{{/* 控制层-源 */}}
{{- $PkgNameLowerCase := .PkgName | FirstCharLowerCase -}}
{{- $TableNameLowerCase := .TableName | FirstCharLowerCase -}}
{{- $PkgNameUpper := .PkgName | FirstCharUpper -}}
{{- $TableNameUpper := .TableName | FirstCharUpper -}}
package {{$PkgNameLowerCase}}Api

import (
	"github.com/Sir-yuChen/funAnalyse/global"
	"github.com/Sir-yuChen/funAnalyse/model/common/ApiReturn"
	"github.com/Sir-yuChen/funAnalyse/model/common/response"
	"github.com/Sir-yuChen/funAnalyse/model/{{$PkgNameLowerCase}}Model"
	"github.com/gin-gonic/gin/binding"
	"github.com/gin-gonic/gin"
	"go.uber.org/zap"
)

type {{$TableNameUpper}}Controller struct{}

// Get{{$TableNameUpper}} 多条件查询
// @Summary {{$TableNameLowerCase}} get
// @Tags 接口归类
// @Accept application/json
// @Produce application/json
// @Param data body model.{{$TableNameUpper}}Model true "请求参数"
// @response 200 {object} response.Response  "接口返回信息"
// @Router /{{ .RouterGroup}}/get{{$TableNameUpper}} [GET]
func (b *{{$TableNameUpper}}Controller) Get{{$TableNameUpper}}(c *gin.Context) {
	var req model.{{$TableNameUpper}}Model
	if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
    	utils.ErrValidatorResp(err, "Get{{$TableNameUpper}}", req, c)
        return
    }
    apiReturn := {{$TableNameLowerCase}}Service.Get{{$TableNameUpper}}(&req)
    response.WithApiReturn(apiReturn, c)
    return
}



// Insert{{$TableNameUpper}}
// @Summary {{$TableNameLowerCase}} insert
// @Tags 接口归类
// @Accept application/json
// @Produce application/json
// @Param data body model.{{$TableNameUpper}}Model true "请求参数"
// @response 200 {object} response.Response  "接口返回信息"
// @Router /{{ .RouterGroup}}/Insert{{$TableNameUpper}} [POST]
func (b *{{$TableNameUpper}}Controller) Insert{{$TableNameUpper}}(c *gin.Context) {
	var req model.{{$TableNameUpper}}Model
    if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
    	utils.ErrValidatorResp(err, "Insert{{$TableNameUpper}}", req, c)
        return
    }
    apiReturn := {{$TableNameLowerCase}}Service.Insert{{$TableNameUpper}}(&req)
    response.WithApiReturn(apiReturn, c)
    return
}
// Update{{$TableNameUpper}}
// @Summary {{$TableNameLowerCase}} update
// @Tags 接口归类
// @Accept application/json
// @Produce application/json
// @Param data body model.{{$TableNameUpper}}Model true "请求参数"
// @response 200 {object} response.Response  "接口返回信息"
// @Router /{{ .RouterGroup}}/update{{$TableNameUpper}} [POST]
func (b *{{$TableNameUpper}}Controller) Update{{$TableNameUpper}}(c *gin.Context) {
	var req model.{{$TableNameUpper}}Model
	 if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
        	utils.ErrValidatorResp(err, "Update{{$TableNameUpper}}", req, c)
            return
     }
    apiReturn := {{$TableNameLowerCase}}Service.Update{{$TableNameUpper}}(&req)
    response.WithApiReturn(apiReturn, c)
    return
}
// Del{{$TableNameUpper}}
// @Summary {{$TableNameLowerCase}} del
// @Tags 接口归类
// @Accept application/json
// @Produce application/json
// @Param data body model.{{$TableNameUpper}}Model true "请求参数"
// @response 200 {object} response.Response  "接口返回信息"
// @Router /{{ .RouterGroup}}/del{{$TableNameUpper}} [Get]
func (b *{{$TableNameUpper}}Controller) Del{{$TableNameUpper}}(c *gin.Context) {
	var req model.{{$TableNameUpper}}Model
	if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
       utils.ErrValidatorResp(err, "Del{{$TableNameUpper}}", req, c)
       return
    }
    apiReturn := {{$TableNameLowerCase}}Service.Del{{$TableNameUpper}}(&req)
    response.WithApiReturn(apiReturn, c)
    return
}



